export default {
  gridRowActiveMode: 2,
  xdataControlName: 'grid',
  loadDefault: true,
  deviewCodeName: 'grid_span',
  deviewId: '9c4c735af7d641e92462626e9e1cdcc6',
  appWFId: 'workflow',
  accUserMode: 2,
  capLanguageRes: {
    lanResTag: 'DE.LNAME.MASTER',
  },
  caption: '表格_合并行或列',
  codeName: 'master_grid_span',
  appDataEntityId: 'web.master',
  appViewEngines: [
    {
      engineCat: 'VIEW',
      engineType: 'GridView',
      id: 'engine',
    },
  ],
  appViewLogics: [
    {
      logicTrigger: 'CUSTOM',
      logicType: 'APPUILOGIC',
      builtinAppUILogic: {
        actionAfterWizard: 'DEFAULT',
        newDataAppView: {
          openMode: 'POPUPMODAL',
          refAppViewId: 'web.master_edit_view',
        },
        appUILogicRefViews: [
          {
            openMode: 'POPUPMODAL',
            refAppViewId: 'web.master_edit_view',
          },
        ],
        builtinLogic: true,
        logicType: 'PREDEFINED',
        viewLogicType: 'APP_NEWDATA',
        id: '新建数据',
      },
      builtinLogic: true,
      id: 'newdata',
    },
    {
      logicTrigger: 'CUSTOM',
      logicType: 'APPUILOGIC',
      builtinAppUILogic: {
        openDataAppView: {
          openMode: 'POPUPMODAL',
          refAppViewId: 'web.master_edit_view',
        },
        editMode: true,
        appUILogicRefViews: [
          {
            openMode: 'POPUPMODAL',
            refAppViewId: 'web.master_edit_view',
          },
        ],
        builtinLogic: true,
        logicType: 'PREDEFINED',
        viewLogicType: 'APP_OPENDATA',
        id: '打开数据',
      },
      builtinLogic: true,
      id: 'opendata',
    },
  ],
  appViewRefs: [
    {
      realOpenMode: 'POPUPMODAL',
      realTitle: '主数据编辑视图',
      refAppViewId: 'web.master_edit_view',
      name: 'EDITDATA',
      id: 'editdata',
    },
    {
      realOpenMode: 'POPUPMODAL',
      realTitle: '主数据编辑视图',
      refAppViewId: 'web.master_edit_view',
      name: 'NEWDATA',
      id: 'newdata',
    },
  ],
  controls: [
    {
      aggMode: 'NONE',
      columnEnableFilter: 2,
      columnEnableLink: 2,
      groupMode: 'NONE',
      groupStyle: 'DEFAULT',
      minorSortDir: 'ASC',
      minorSortAppDEFieldId: 'status',
      orderValueAppDEFieldId: 'px',
      degridColumns: [
        {
          clconvertMode: 'FRONT',
          dataItemName: 'status',
          excelCaption: '状态',
          appCodeListId: 'web.mock__cl_status',
          appDEFieldId: 'status',
          valueType: 'SIMPLE',
          aggMode: 'NONE',
          align: 'LEFT',
          caption: '状态',
          codeName: 'status',
          columnType: 'DEFGRIDCOLUMN',
          noPrivDisplayMode: 1,
          width: 100,
          widthUnit: 'PX',
          enableSort: true,
          id: 'status',
        },
        {
          clconvertMode: 'NONE',
          dataItemName: 'name',
          excelCaption: '名称',
          appDEFieldId: 'name',
          valueType: 'SIMPLE',
          aggMode: 'NONE',
          align: 'LEFT',
          capLanguageRes: {
            lanResTag: 'DEF.LNAME.MASTER.NAME',
          },
          caption: '名称',
          codeName: 'name',
          columnType: 'DEFGRIDCOLUMN',
          noPrivDisplayMode: 1,
          width: 150,
          widthUnit: 'PX',
          enableSort: true,
          id: 'name',
        },
        {
          clconvertMode: 'NONE',
          dataItemName: 'quantity',
          excelCaption: '数量',
          appDEFieldId: 'quantity',
          valueType: 'SIMPLE',
          aggMode: 'NONE',
          align: 'LEFT',
          caption: '数量',
          codeName: 'quantity',
          columnType: 'DEFGRIDCOLUMN',
          noPrivDisplayMode: 1,
          width: 100,
          widthUnit: 'PX',
          enableSort: true,
          id: 'quantity',
        },
      ],
      degridDataItems: [
        {
          appDEFieldId: 'status',
          valueType: 'SIMPLE',
          dataType: 9,
          id: 'status',
        },
        {
          appDEFieldId: 'name',
          valueType: 'SIMPLE',
          dataType: 25,
          id: 'name',
        },
        {
          appDEFieldId: 'quantity',
          valueType: 'SIMPLE',
          dataType: 6,
          id: 'quantity',
        },
        {
          appDEFieldId: 'id',
          valueType: 'SIMPLE',
          dataType: 25,
          id: 'srfkey',
        },
        {
          appDEFieldId: 'id',
          valueType: 'SIMPLE',
          dataType: 25,
          id: 'srfdataaccaction',
        },
        {
          appDEFieldId: 'region_id',
          valueType: 'SIMPLE',
          dataType: 25,
          id: 'region_id',
        },
        {
          appDEFieldId: 'category_type',
          valueType: 'SIMPLE',
          dataType: 25,
          id: 'srfdatatype',
        },
        {
          appDEFieldId: 'category_type',
          valueType: 'SIMPLE',
          dataType: 25,
          id: 'category_type',
        },
        {
          appDEFieldId: 'category_id',
          valueType: 'SIMPLE',
          dataType: 25,
          id: 'category_id',
        },
        {
          appDEFieldId: 'name',
          valueType: 'SIMPLE',
          dataType: 25,
          id: 'srfmajortext',
        },
        {
          appDEFieldId: 'wf_status',
          valueType: 'SIMPLE',
          dataType: 25,
          id: 'wf_status',
        },
      ],
      degridEditItems: [
        {
          caption: '标识',
          codeName: 'srfkey',
          enableCond: 3,
          appDEFieldId: 'id',
          editor: {
            editorType: 'HIDDEN',
            valueType: 'SIMPLE',
            editable: true,
            id: 'srfkey',
          },
          allowEmpty: true,
          id: 'srfkey',
        },
      ],
      pagingMode: 1,
      pagingSize: 20,
      sortMode: 'REMOTE',
      hasWFDataItems: true,
      enableCustomized: true,
      enablePagingBar: true,
      navViewPos: 'NONE',
      fetchControlAction: {
        appDEMethodId: 'fetch_default',
        appDataEntityId: 'web.master',
        id: 'fetch',
      },
      removeControlAction: {
        appDEMethodId: 'remove',
        appDataEntityId: 'web.master',
        id: 'remove',
      },
      autoLoad: true,
      showBusyIndicator: true,
      codeName: 'main18',
      controlType: 'GRID',
      logicName: '表格_合并行或列_表格',
      appDataEntityId: 'web.master',
      controlAttributes: [
        {
          attrName: 'span-method',
          attrValue:
            'let columnIndex = metadata.columnIndex;\r\nlet row = metadata.row;\r\nlet column = metadata.column;\r\nlet rowIndex = metadata.rowIndex;\r\nlet tableData = metadata.items;\r\nlet spanArr = [];\r\n// 处理第一列的行合并\r\nif (columnIndex === 1) {\r\n  let temp = { startRow: 0, endRow: 1 };\r\n  let spans = [];\r\n  for (let i = 0; i < tableData.length; i++) {\r\n    if (i === 0) {\r\n      spans.push(temp);\r\n    }\r\n    if(i + 1 === tableData.length){\r\n      if (tableData[i - 1][column.property] === tableData[i][column.property]) {\r\n        temp.endRow += 1;\r\n      }else{\r\n        temp = { startRow: i, endRow: i + 1 };\r\n        spans.push(temp);\r\n      }\r\n    }else{\r\n      if (tableData[i][column.property] === tableData[i + 1][column.property]) {\r\n        temp.endRow += 1;\r\n      } else {\r\n        temp = { startRow: i + 1, endRow: i + 1 };\r\n        spans.push(temp);\r\n      }\r\n    }\r\n  }\r\n  if(spans && spans.length >0){\r\n    let target = spans.find((item) =>{\r\n      return item.startRow <= rowIndex  && rowIndex < item.endRow;\r\n    })\r\n    if(target && target.startRow === rowIndex){\r\n        return {\r\n          rowspan: target.endRow - target.startRow,\r\n          colspan: 1\r\n        }\r\n    }else{\r\n        return {\r\n          rowspan: 0 ,\r\n          colspan: 0\r\n        }\r\n    }\r\n  }\r\n}',
          id: 'spanmethod',
        },
      ],
      controlParam: {
        id: 'grid',
      },
      modelId: '0920702c22fbd4b05e55ac9215e5f91e',
      modelType: 'PSDEGRID',
      name: 'grid',
      id: 'web.master.main18',
    },
    {
      searchButtonStyle: 'DEFAULT',
      deformPages: [
        {
          layout: {
            columnCount: 24,
            layout: 'TABLE_24COL',
          },
          caption: '常规条件',
          codeName: 'formpage1',
          detailStyle: 'DEFAULT',
          detailType: 'FORMPAGE',
          id: 'formpage1',
        },
      ],
      layout: {
        columnCount: 24,
        layout: 'TABLE_24COL',
      },
      tabHeaderPos: 'TOP',
      noTabHeader: true,
      autoLoad: true,
      showBusyIndicator: true,
      codeName: 'main83',
      controlType: 'SEARCHFORM',
      logicName: '表格_合并行或列_搜索表单',
      appDataEntityId: 'web.master',
      controlParam: {
        id: 'searchform',
      },
      modelId: '092778bc27aa3ffced92714ca5d82197',
      modelType: 'PSDEFORM_SEARCHFORM',
      name: 'searchform',
      id: 'web.master.main83',
    },
    {
      xdataControlName: 'grid',
      codeName: 'grid_span_toolbar',
      controlType: 'TOOLBAR',
      logicName: '表格_合并行或列_工具栏',
      appDataEntityId: 'web.master',
      controlParam: {
        id: 'toolbar',
      },
      modelId: '23738c34e7cbff3333416f290c7267a9',
      modelType: 'PSDETOOLBAR',
      name: 'toolbar',
      id: 'grid_span_toolbar',
    },
    {
      groupMode: 'SINGLE',
      controlType: 'SEARCHBAR',
      appDataEntityId: 'web.master',
      controlParam: {
        id: 'searchbar',
      },
      id: 'searchbar',
    },
    {
      capLanguageRes: {
        lanResTag: 'DE.LNAME.MASTER',
      },
      caption: '表格_合并行或列',
      codeName: 'grid_span_captionbar',
      controlType: 'CAPTIONBAR',
      appDataEntityId: 'web.master',
      controlParam: {},
      name: 'captionbar',
      id: 'grid_span_captionbar',
    },
  ],
  viewLayoutPanel: {
    layoutBodyOnly: true,
    useDefaultLayout: true,
    layoutPanel: true,
    codeName: 'layoutpanel',
    controlStyle: 'APPDEGRIDVIEW',
    controlType: 'VIEWLAYOUTPANEL',
    appDataEntityId: 'web.master',
    controlParam: {},
    id: 'layoutpanel',
  },
  title: '表格_合并行或列',
  viewStyle: 'DEFAULT',
  viewType: 'DEGRIDVIEW',
  enableDP: true,
  showCaptionBar: false,
  modelId: '640624641020b6f5f4f191e7edf93fd7',
  modelType: 'PSAPPDEVIEW',
  name: 'MASTERgrid_span',
  id: 'web.master_grid_span',
};
